//io函数
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <math.h>

int main()
{
	//打开lcd
	int lcd_fd;
	lcd_fd = open("dev/fb0", O_RDWR);
	if(-1 == lcd_fd)
	{
		perror("open lcd failed!\n");
		return -1;
	}
	else
	{
		printf("open lcd success!\n");
	}
	int col_buf[800*480*4];
	int x,y,t=1,i=99;
	for(y=140;y<240;y++)
	{
		for(x=150;x<250;x++)
		{
			col_buf[800*y+x]=0xffff00;
		}
	}
	for(y=1;y<100;y++)
	{
		for(x=100;x>i;x--)
		{
			col_buf[800*(y)+(x)]=0xffff00;
		}
		for(x=1;x<t;x++)
		{
			col_buf[800*(y)+(x+100)]=0xffff00;
		}
		t++;
		i--;
	}
	for(y=0;y<100;y++)
	{
		for(x=50-sqrt(50*50-(50-y)*(50-y));x<50+sqrt(50*50-(50-y)*(50-y));x++)
		{
			col_buf[800*(y+100)+(x+300)]=0xffff00;
		}
	}
	
	write(lcd_fd,col_buf,sizeof(col_buf));
	
	close(lcd_fd);

	return 0;
}